package com.fegin.Hystrix.admin;

import com.fegin.bean.admin.AdminRole;

import com.fegin.bean.common.layuiBean.ResultPage;
import com.fegin.bean.common.layuiBean.VoPage;
import com.fegin.client.admin.RoleFegin;
import com.util.Respons.ResponseUtil;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author 张子艺
 * @packge com.fegin.Hystrix
 * @data 2019-01-16 09:23
 * @project currencycloud
 */
@Component
public class RoleFigenHystrix implements FallbackFactory<RoleFegin> {

    @Override
    public RoleFegin create(Throwable throwable) {
        return new RoleFegin() {
            @Override
            public ResultPage<AdminRole> findRoleByPage(VoPage voPage,int flag, Long loginId) {
                ResultPage<AdminRole> roleResultPage=new ResultPage<>();
                roleResultPage.setMsg("服务器繁忙，请刷新重试...");
                roleResultPage.setCode(1);
                return roleResultPage;
            }

            @Override
            public Map<String, Object> insertRole(String roleName, String menuId,Long userId) {
                return ResponseUtil.getExceptionMap();
            }

            @Override
            public Map<String, Object> insertDistribution(String roleName, String menuId,Long userId) {
                return ResponseUtil.getExceptionMap();
            }

            @Override
            public Map<String, Object> delRole(Long roleId) {
                return ResponseUtil.getExceptionMap();
            }

            @Override
            public Map<String, Object> findRoleAll( Long loginId,int flag) {
                return ResponseUtil.getExceptionMap();
            }
        };
    }
}
